package com.salas.entity;
// Generated 2009-3-4 20:18:47 by Hibernate Tools 3.2.0.CR1

import static javax.persistence.GenerationType.IDENTITY;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.validator.Length;

/**
 * Product generated by hbm2java
 */
@Entity
@Table(name = "product", catalog = "jacks")
public class Product implements java.io.Serializable {


	private static final long serialVersionUID = 1L;
	private Integer productId;
	private String design;
	private String length;
	private String style;
	private String waist;
	private String fitSeason;
	private String color;
	private String size;
	private BigDecimal price;
	private Float discount;
	private String pictureUrl;
	private String description;
	private List<Orderitem> orderitems = new ArrayList<Orderitem>();
	private List<Image> productImage = new ArrayList<Image>();
	
	Inventory inventory;
	
	
	
	public Product() {
	}

	public Product(String design, String length, String style, String waist,
			String fitSeason, String color, String size, BigDecimal price,
			Float discount, String pictureUrl,String description, List<Orderitem> orderitems) {
		this.design = design;
		this.length = length;
		this.style = style;
		this.waist = waist;
		this.fitSeason = fitSeason;
		this.color = color;
		this.size = size;
		this.price = price;
		this.discount = discount;
		this.pictureUrl = pictureUrl;
		this.description = description;
		this.orderitems = orderitems;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "Product_ID", unique = true, nullable = false)
	public Integer getProductId() {
		return this.productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	@Column(name = "design", length = 10)
	@Length(max = 10)
	public String getDesign() {
		return this.design;
	}

	public void setDesign(String design) {
		this.design = design;
	}

	@Column(name = "length", length = 10)
	@Length(max = 10)
	public String getLength() {
		return this.length;
	}

	public void setLength(String length) {
		this.length = length;
	}

	@Column(name = "style", length = 10)
	@Length(max = 10)
	public String getStyle() {
		return this.style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	@Column(name = "waist", length = 10)
	@Length(max = 10)
	public String getWaist() {
		return this.waist;
	}

	public void setWaist(String waist) {
		this.waist = waist;
	}

	@Column(name = "Fit_Season", length = 10)
	@Length(max = 10)
	public String getFitSeason() {
		return this.fitSeason;
	}

	public void setFitSeason(String fitSeason) {
		this.fitSeason = fitSeason;
	}

	@Column(name = "color", length = 10)
	@Length(max = 10)
	public String getColor() {
		return this.color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	@Column(name = "size", length = 10)
	@Length(max = 10)
	public String getSize() {
		return this.size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	@Column(name = "price", precision = 10)
	public BigDecimal getPrice() {
		return this.price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	@Column(name = "discount", precision = 12, scale = 0)
	public Float getDiscount() {
		return this.discount;
	}

	public void setDiscount(Float discount) {
		this.discount = discount;
	}

	@Column(name = "pictureURL", length = 40)
	@Length(max = 40)
	public String getPictureUrl() {
		return this.pictureUrl;
	}

	public void setPictureUrl(String pictureUrl) {
		this.pictureUrl = pictureUrl;
	}
	
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product")
	public List<Orderitem> getOrderitems() {
		return this.orderitems;
	}

	public void setOrderitems(List<Orderitem> orderitems) {
		this.orderitems = orderitems;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "product")
	public List<Image> getProductImage() {
		return productImage;
	}

	public void setProductImage(List<Image> productImage) {
		this.productImage = productImage;
	}
	
	@Column(name = "description", length = 80)
	@Length(max = 80)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
    @OneToOne(fetch=FetchType.LAZY,mappedBy="product")
    public Inventory getInventory() {
        return inventory;
    }
    public void setInventory(Inventory inventory) {
        this.inventory = inventory;
    }
    
}
